package io.scnb.lesson001.demo27.test7;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

@Lazy   // 配置类上使用了@Lazy，会对当前类中所有@Bean标注的方法生效
@Configuration
public class MainConfig7 {
    
    @Bean
    public String name() {
        System.out.println("create bean:name");
        return "scnb";
    }
    
    @Bean
    public String address() {
        System.out.println("create bean:address");
        return "北京市";
    }
    
    @Bean
    @Lazy(value = false)
    public Integer age() {
        System.out.println("create bean:age");
        return 30;
    }
}
